<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "acc_project".
 *
 * @property integer $id
 * @property integer $acc_id
 * @property integer $project_id
 *
 * @property Project $project
 * @property User $acc
 * @property WorkAccount[] $workAccounts
 */
class AccProject extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'acc_project';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['acc_id', 'project_id'], 'required'],
            [['acc_id', 'project_id'], 'integer']
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'acc_id' => 'Acc ID',
            'project_id' => 'Project ID',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getProject()
    {
        return $this->hasOne(Project::className(), ['id' => 'project_id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getUser()
    {
        return $this->hasOne(User::className(), ['acc_id' => 'acc_id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getWorkAccounts()
    {
        return $this->hasMany(WorkAccount::className(), ['acc_pro_id' => 'id']);
    }
}
